<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends CI_Controller {

	function __construct(){
        parent::__construct();
    }
	
	
	public function index(){
		$html=array();
		$this->load->view('login',$html);
	}



	public function login_submit() {
		
		
		
		$info['user']=$this->input->post('uname');
		$info['password']=$this->input->post('pwd');
		
		
		$info['vcode']   =   MD5(strtoupper($this->input->post('vcode')));
		$vcode=my_verification_code();
		//print_r($info);
		//die();verification_code
		
		
		
		
		if(empty($info['user']) || empty($info['password']) ){
			//redirect('/');
			//die();
		}	
		
		
		/*
		if($info['vcode'] != $vcode)
		{
		//	redirect('/');
		//	die();
		}
		*/	
		if($this->login_lib->login($info))
		{
			redirect('/main');
			die();
		}
		else
		{
			redirect('/login');
			die();
		}
	}
	

	public function logout() {
		
		$this->login_lib->logout();
		
	}
	
	
}

/* End of file login.php */
/* Location: ./application/controllers/login.php */